import { PasswordUpdate } from '../types/User';
import axiosInstance from './axios';

const API_URL = '/users';


export const login = async (formData: {}) => {
  try {
       const response = await axiosInstance.post(`/token`, formData.toString(), {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      });
    return response;
  } catch (error) {
    throw error;
  }
};


export const updatePassword = async (id: number, passwords: PasswordUpdate) => {
  const res = await axiosInstance.put(`${API_URL}/${id}/password`, passwords);
  return res.data;
};